<?php
//$intOrderHeaderID = 18;
if (defined("SITE")){
	$strSite = SITE;
	//$strSite.sprintf("%08d",$intOrderHeaderID)
}
include (MODULE_SHOP_HOST . "/navigation/EmailHeader");
include (MODULE . "/action/qrySelectOrderHeader");
$strDeliveryName 		= 	$myrow["DeliveryName"];
$strDeliveryAddress 	=	$myrow["DeliveryAddress"];
$strDeliveryAddress2 	=  	$myrow["DeliveryAddress2"];
$strDeliveryCity 		= 	$myrow["DeliveryCity"];
$strDeliveryRegion 		= 	$myrow["DeliveryRegion"];
$strDeliveryPostalCode 	= 	$myrow["DeliveryPostalCode"];
unset($intTotal);
//STYLE='table-layout: fixed'
echo  "<link REL=stylesheet HREF='http://$SERVER_NAME/shop.css'>
	<table width='600' height='1000' align='center' class='Normal' border='0'  bgcolor='White'>
	<tr align='left' valign='top'>
		<td colspan='6'  width='600' height='100'><img src='http://".$SERVER_NAME."/images".SITE_SUFFIX."/EmailHeader.jpg' width='600' align='top' border='0'/></td>
	</tr>

	<tr VALIGN=TOP>
		<td colspan='6' align='center'  height='70'>
			<h1 class='orderheading'>Delivery Note</h1>
		</td>
	</tr>
	<tr VALIGN=TOP>
		<td colspan='3' align='left' class='Normal' height='40'>
			<b>Order Number:</b> ".$strSite.sprintf("%08d",$intOrderHeaderID)."
		</td>
		<td colspan='3' align='right'  height='40'>
			<b>Dispatch Date:</b> ".ReformatFromMySqlDate($myrow["ShippedDate"])."
		</td>
	</tr>
	
	<tr>
		<td colspan='3' valign='top'  height='170'>
			<br/><b>Sold to:</b>
			<br/><br/>".$myrow["ShipName"]."
			<br/>".$myrow["ShipAddress"];

				if ($myrow["ShipAddress2"]){
					echo "<br/>".$myrow["ShipAddress2"];
				}
		
echo "
			<br/>".$myrow["ShipCity"]."
			<br/>".$myrow["ShipRegion"]."
			<br/>".$myrow["ShipPostalCode"]."
		</td>

		<td colspan='3' valign='top'>
			<br/><b>Deliver to:</b>
			<br/><br/>".$myrow["DeliveryName"]."
			<br/>".$myrow["DeliveryAddress"];

				if ($myrow["DeliveryAddress2"]){
					echo "<br/>".$myrow["DeliveryAddress2"];
				}
		
echo "
			<br/>".$myrow["DeliveryCity"]."
			<br/>".$myrow["DeliveryRegion"]."
			<br/>".$myrow["DeliveryPostalCode"]."
		</td>
	</tr>
	
	<tr>
		<td colspan='6' align='left'  height='20'>
";
			if(EXTRA_ORDER_FIELD){
				echo "<br/><b>".EXTRA_ORDER_FIELD."</b>".$myrow["OtherInfo"]."<br/>";
			}
echo "
		</td>
	</tr>
	
	<tr align='center' height='20'>
        <td align='left' width='230'><b>Product</b></td>
		<td align='center' width='30'><b>qty</b></td>
		<td align='center' width='60'>&nbsp;</td>
		<td align='center' width='90'>&nbsp;</td>
		<td align='center' width='80'>&nbsp;</td>
		<td align='right' width='120'>&nbsp;</td>
    </tr>";
	
	include (MODULE . "/action/qrySelectOrderDetails");
	do{
		echo "<tr align='right' bgcolor=\"".switch_background($boBG)."\">
	 		<td align='left' height='10' class='small'>";
			
					if ($myrow["QuantityPerUnit"]>1){
						echo $myrow["QuantityPerUnit"]."&nbsp;";
					}
					
				echo $myrow["Product"]."
			</td>
			<td>".$myrow["Quantity"]."</td>
			<td>&nbsp;</td>
	        <td>&nbsp;</td>
	        <td>&nbsp;</td>
			<td>&nbsp;</td>
	    </tr>";
		$boBG = -1 - $boBG; //alternate $boBG values from -1 and 0
	} while ($myrow = mysql_fetch_array($result));
	

	
    echo "

	
	<tr>
 		<td colspan='6'  height='20' align='center'>".DELIVERY_NOTE_MESSAGE."</td>
    </tr>";
	

echo "
	<tr valign='bottom' height='20'>
 		<td colspan='6' align='center' class='small' height='20'>

			&nbsp;
		</td>
    </tr>
	
	<tr valign='bottom' height='1'>
 		<td colspan='6' align='center' class='small' height='1' bgcolor='silver'>
			<img src='./images/space.gif' height='1' border='0' alt=''>
		</td>
    </tr>

	
	<tr valign='bottom'>
 		<td colspan='6' align='center' class='small' height='30'>
			<table border='0' cellpadding='2' width='100%' class='small'>
				<tr height='30'>
					<td width='100%'>
						<b>Order No:</b>&nbsp;".$intOrderHeaderID."
					</td>
				</tr>
			</table>
		</td>
    </tr>
	
	<tr valign='bottom' height='1'>
 		<td colspan='6' align='center' class='small' height='1' bgcolor='silver'>
			<img src='./images/space.gif' height='1' border='0' alt=''>
		</td>
    </tr>
	
	<tr valign='bottom' height='20'>
 		<td colspan='6' align='center' class='small' height='30'>
			<table border='0' cellpadding='2' width='100%' class='small'>
				<tr height='30'>
					<td width='100%'>
						<b>Order No:</b>&nbsp;".$intOrderHeaderID."
					</td>
				</tr>
			</table>
		</td>
    </tr>
	
	<tr valign='bottom' height='1'>
 		<td colspan='6' align='center' class='small' height='1' bgcolor='silver'>
			<img src='./images/space.gif' height='1' border='0' alt=''>
		</td>
    </tr>
	
	<tr valign='bottom'>
		<td colspan='6'>
			<table border='0' cellpadding='2' width='100%' class='Normal'>
				<tr valign='top' height='100'>
					<td width='150'>&nbsp;</td>
					<td colspan='1' class='small'>
						<br/><br/>If undelivered Tabernus Ltd, CO4 5NE 
						<br/>
					</td>
				
				</tr>
				<tr valign='top' height='300'>
					<td width='150'>&nbsp;</td>
					<td width='100%' align='left'>
						<br/><br/>".$strDeliveryName."
						<br/>".$strDeliveryAddress;
			
							if ($strDeliveryAddress2){
								echo "<br/>".$strDeliveryAddress2;
							}
		
echo "
						<br/>".$strDeliveryCity."
						<br/>".$strDeliveryRegion."
						<br/>".$strDeliveryPostalCode."
					</td>
				</tr>
			</table>
		</td>
    </tr>
	
</table>";

?>